package com.etsmtl.log320.sudo;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.Writer;

public class SudoFileManager {

	
	public static String readFile(String sourceFile){
		Reader inputStream=null;
		String str="";
		try{
			File file = new File(sourceFile);
			FileInputStream fis = new FileInputStream(file);
			InputStreamReader isr = new InputStreamReader(fis,"ISO-8859-1");
			inputStream = new BufferedReader(isr);
			int c;
			
            while ((c = inputStream.read()) != -1) {
            	if (c>=48 && c<=57){
            		str+=(char)c;
            	}
            }
		}catch(FileNotFoundException e){
			
		}catch(IOException ie){
			
		}
		return str;
	}
	
	public static void writeFile(String outputFile,String fileContent){
		Writer outputStream=null;
		try{
			File file = new File(outputFile);
			FileOutputStream fos = new FileOutputStream(file);
			
		}catch(FileNotFoundException e){
			
		}catch(IOException ie){
			
		}
	}
}
